﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Threading;

namespace PSE.Deployment.TeamFoundation.Communication
{
    public class Library : CommunicationBase
    {
        #region Singleton
        private static Library instance;
        protected Library() {}
        public static Library Instance
        {
            get
            {
                if (instance == null)
                {
                    Mutex mutex = new Mutex();
                    mutex.WaitOne();

                    if (instance == null)
                        instance = new Library();

                    mutex.Close();
                }
                return instance;
            }
        }
        #endregion Singleton

        public string GetLibraryPath()
        {
            string path = System.IO.Path.Combine(System.Reflection.Assembly.GetExecutingAssembly().Location, 
                System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + ".exe");

            RaiseEventTrace(string.Format("Obtendo o Caminho para Library. Caminho: {0}", path));

            return path;
        }
    }
}
